package com.medusa.aps.business.modules.basic.model.input;

import cn.hutool.core.annotation.Alias;
import com.medusa.aps.business.model.constant.RegexPool;
import com.medusa.aps.business.model.enums.State;
import com.medusa.aps.business.modules.basic.mp.entity.SupplierMaterialDTO;
import com.medusa.aps.business.common.web.valid.group.Update;
import com.medusa.aps.business.global.model.constant.RegexPools;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.Valid;
import jakarta.validation.constraints.NotBlank;
import jakarta.validation.constraints.NotNull;
import jakarta.validation.constraints.Pattern;
import jakarta.validation.constraints.Size;
import lombok.Getter;
import lombok.Setter;

import java.util.List;

@Getter
@Setter
public class SupplierDTO {

    /**
     * 主键
     */
    @Schema(description = "主键")
    @NotNull(message = "主键不能为空", groups = {Update.class})
    private Long id;
    /**
     * 供应商编码
     */
    @Schema(description = "供应商编码")
    @NotBlank(message = "供应商编码不能为空")
    @Size(max = 50, message = "供应商编码长度不能超过50")
    @Pattern(regexp = RegexPool.ORDER_NO, message = "供应商编码只支持数字、字母、符号")
    private String supplierCode;
    /**
     * 供应商名称
     */
    @Schema(description = "供应商名称")
    @NotBlank(message = "供应商名称不能为空")
    @Size(max = 50, message = "供应商名称长度不能超过50")
    private String supplierName;

    /**
     * 供应商电话
     */
    @Alias("供应商电话")
    @Schema(description = "供应商电话")
    @Pattern(regexp = RegexPools.MOBILE_TEL, message = "请输入正确的电话号码，固话请用-分隔区号")
    @Size(max = 50, message = "供应商电话长度不能超过50")
    private String supplierPhone;

    /**
     * 供应商姓名
     */
    @Alias("供应商姓名")
    @Schema(description = "供应商姓名")
    @Size(max = 50, message = "供应商姓名长度不能超过50")
    private String supplierPerson;


    /**
     * 状态
     */
    @Schema(description = "状态")
    private State state;

    /**
     * 供应商物料
     */
    @Valid
    @Schema(description = "供应商物料")
    private List<SupplierMaterialDTO> supplierMaterials;


}
